#include<iostream>
#include<stdlib.h>
#include<unistd.h>

using namespace std;

int main()
{
        string body;
        string method=getenv("METHOD");
        if(method=="GET")
        {
            string query_string=getenv("QUERY_STRING");
            cerr<<query_string<<endl;
            cout<<query_string<<endl;
        }
        else if(method=="POST")
        {
            int length=atoi(getenv("Content-Length"));
            char ch=0;
            while(length--)
            {
                read(0,&ch,1);
                body.push_back(ch);
            }
            cerr<<body<<endl;
            cout<<body<<endl;
        }
    return 0;
}
